import { createRouter, createWebHistory } from 'vue-router'
/**
 * 导入路径
 */
import login from "../views/login.vue";
import Homepage from "../views/BaseFrame/HomePage.vue";
import PeopleAdd from "../views/People/PeopleAdd.vue";
import PeopleManager from "../views/People/PeopleManager.vue";
import PeopleUpdate from "../views/People/PeopleUpdate.vue";
import Tree from "../views/Tree/tree.vue";
import EventManager from "../views/Event/EventManager.vue";
import EventAdd from "../views/Event/EventAdd.vue";
import EventUpdate from "../views/Event/EventUpdate.vue";
import Home from "../views/HomePage/Home.vue";



const routes = [
    {
        path: '/Homepage',
        name: '系统管理员',
        component: Homepage,
        // 设置系统管理员登录以后的默认页面
        // 构建页面的父子级关系，使得页面跳转在当前页面进行，而不会通过创建一个新页面来实现
        children: [
            {
                path: '/Home',
                name: '家谱首页',
                component: Home
            },
            {
                path: '/peopleManager',
                name: '家谱管理',
                component: PeopleManager
            },
            {
                path: '/peopleAdd',
                name: '家谱添加',
                component: PeopleAdd
            }, {
                path: '/peopleUpdate',
                name: '家谱修改',
                component: PeopleUpdate
            }, {
                path: '/Tree',
                name: '家谱图',
                component: Tree
            }, {
                path: '/eventManager',
                name: '履历列表',
                component: EventManager
            }, {
                path: '/eventAdd',
                name: '添加履历',
                component: EventAdd
            }, {
                path: '/eventUpdate',
                name: '修改履历',
                component: EventUpdate
            }
        ]
    },
    {
        // 地址栏的映射名字
        path: '/',
        name: '登录',
        // 映射组件
        component: login
    }
]

export const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

export default router